<?
/* HTML inputs, www.ecomgear.cn */
/* ----------------*/
  class Html
  {
	  function __construct(){}
	  /* Param: title, kwd, dpn, copy, author, davee 2012-5-19 */
	  function meta($title, $kwd, $dpn, $copy='', $author='')
	  {
		  $txt='<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />';
		  $txt.='<title>'.$title.'</title>';
		  $txt.='<meta name="keywords" content="'.$kwd.'">';
		  $txt.='<meta name="description" content="'.$dpn.'">';
		  if($copy!='')$txt.='<meta name="copyright" content="'.$copy.'">';
		  if($author!='')$txt.='<meta name="author" content="'.$author.'">';
		  return $txt;
	  }
	  function form($action, $isfile=0, $class=''){
		  $txt='<form method="post" action="'.$action.'" ';
		  $txt.='class="'.$class.'" ';
		  if($isfile==1)$txt.='enctype="multipart/form-data"';
		  return $txt.='>';
	  }
	  function former(){ return '</form>'; }
	  function hidden($name, $value='', $class=''){
		  $txt='<input type="hidden" name="'.$name.'" value="'.decode($value).'" class="'.$class.'" />';
		  return $txt;
	  }
	  function text($name, $value='', $class=''){
		  $txt='<input type="text" name="'.$name.'" value="'.decode($value).'" class="'.$class.'" />';
		  return $txt;
	  }
	  function password($name, $value='', $class=''){
		  $txt='<input type="password" name="'.$name.'" value="'.decode($value).'" class="'.$class.'" />';
		  return $txt;
	  }
	  function cfile($name, $class=''){
		  $txt='<input type="file" name="'.$name.'" class="'.$class.'" />';
		  return $txt;
	  }
	  function textarea($name, $value='', $cols='24', $rows='8', $class='', $id=''){
		  $txt='<textarea cols="'.$cols.'" rows="'.$rows.'" name="'.$name.'" class="'.$class.'" id="'.$id.'">'.decode($value).'</textarea>';
		  return $txt;
	  }
	  function select($name, $value='', $array, $id='id', $option='name', $class='', $onchange=''){
		  $txt='<select name="'.$name.'" class="'.$class.'" '.(($onchange!='')?"onchange=\"$onchange\"":"").'>';
		  //if($isdata)
//			  while($row=mysql_fetch_array($array)){
//				  $sel='';
//				  if($value==$row["$id"]) $sel=' selected';
//				  $txt.='<option value="'.$row["$id"].'"'.$sel.'>'.$row["$option"].'</option>';
//				  }
//		  else 
			foreach($array as $row){
			  $sel='';
			  if($value==$row["$id"]) $sel=' selected="selected" ';
			  $txt.='<option value="'.$row["$id"].'" '.$sel.'>'.$row["$option"].'</option>';
			  }
		  $txt.='</select>';
		  return $txt;
		  }
	function checkbox($name, $checked=1, $class=''){
		$ischecked=$checked?' checked ':'';
		$txt='<input type="checkbox" name="'.$name.'" '.$ischecked.' value="1">';
		return $txt;
		}
	function submit($name, $value='', $class=''){
		$txt='<input type="submit" value="'.decode($value).'" class="'.$class.'" />';
		return $txt;
	}
  }
?>